package reflect;

import java.util.Scanner;

public class ReflectDemo2 {
    public static void main(String[] args) throws Exception {

        Scanner scanner = new Scanner(System.in);
        System.out.println("输入需要实例化的类名:");
        String str = scanner.nextLine();
        Class cls = Class.forName(str);
        Object obj = cls.newInstance();
        System.out.println(obj);
    }

}
